#ifndef ZIGBUSORDER_H
#define ZIGBUSORDER_H

#include "ZigbusItem.h"

#define ORDER_SIZE 5

#define ORDER_OFF 0x00
#define ORDER_ON 0x01
#define ORDER_TOGGLE 0x02
#define ORDER_SERVO 0x03
#define ORDER_TEXT 0x04
#define ORDER_PWM 0x05
#define ORDER_HEATER 0x06
#define ORDER_STATE 0x07
#define ORDER_SERIAL 0x08
#define ORDER_REMOTE 0x09
#define ORDER_PING 0x0A
#define ORDER_METEO 0x0B

#define ORDER_TIE 0x0E
//OUTPUT  REFERNCE INVERS ACTIV   TIE
//0000000  0000000   1     1     01110

#define ORDER_REBOOT 0x1A

#define ORDER_CONFIG 0x1E
#define ORDER_INIT 0x1F

class ZigbusOrder : public ZigbusItem
{
public:
    ZigbusOrder();
    ZigbusOrder(int value);
    ZigbusOrder(const QString& str);
    ZigbusOrder(const ZigbusOrder& other);
    virtual ~ZigbusOrder();

    virtual QString text() const;

    static ZigbusOrder OFF() { return ZigbusOrder(ORDER_OFF); }
    static ZigbusOrder ON() { return ZigbusOrder(ORDER_ON); }
    static ZigbusOrder TOGGLE() { return ZigbusOrder(ORDER_TOGGLE); }
    static ZigbusOrder SERVO() { return ZigbusOrder(ORDER_SERVO); }
    static ZigbusOrder TEXT() { return ZigbusOrder(ORDER_TEXT); }
    static ZigbusOrder PWM() { return ZigbusOrder(ORDER_PWM); }
    static ZigbusOrder HEATER() { return ZigbusOrder(ORDER_HEATER); }
    static ZigbusOrder STATE() { return ZigbusOrder(ORDER_STATE); }
    static ZigbusOrder SERIAL() { return ZigbusOrder(ORDER_SERIAL); }
    static ZigbusOrder REMOTE() { return ZigbusOrder(ORDER_REMOTE); }
    static ZigbusOrder PING() { return ZigbusOrder(ORDER_PING); }
    static ZigbusOrder METEO() { return ZigbusOrder(ORDER_METEO); }
    static ZigbusOrder TIE() { return ZigbusOrder(ORDER_TIE); }
    static ZigbusOrder REBOOT() { return ZigbusOrder(ORDER_REBOOT); }
    static ZigbusOrder CONFIG() { return ZigbusOrder(ORDER_CONFIG); }
    static ZigbusOrder INIT() { return ZigbusOrder(ORDER_INIT); }
    static ZigbusOrder INVALID() { return ZigbusOrder(-1); }
    virtual QString type() const { return "order"; }
};

#endif // ZIGBUSORDER_H
